﻿CREATE PROCEDURE [dbo].[yaf_category_delete](
                @CategoryID INT)
AS
    BEGIN
        DECLARE  @flag INT
        IF EXISTS (SELECT 1
                   FROM   yaf_Forum
                   WHERE  CategoryID = @CategoryID)
        BEGIN
            SET @flag = 0
        END
        ELSE
        BEGIN
            DELETE FROM yaf_Category
            WHERE       CategoryID = @CategoryID
            SET @flag = 1
        END
        SELECT @flag
    END


